package com.clkj.sunhelp.mvp.base;

import android.support.v4.app.DialogFragment;
import android.view.View;

import com.clkj.sunhelp.common.SharePreKey;
import com.clkj.sunhelp.util.CommonUtil;
import com.clkj.sunhelp.widget.LoadingProgressDialog;

/**
 * Created by Administrator on 2017/3/23.
 */

public abstract class BaseDialogFragment extends DialogFragment {

    public abstract void initData();

    public abstract void assignView(View view);

    public abstract void initView();

    public boolean isLogin()
    {
        return (boolean) CommonUtil.getShareValue(SharePreKey.SP_KEY_LOGIN_TAG,false);
    }


    LoadingProgressDialog progressDialog;

    public void showProgressDialog(boolean canBack, String loadingMsg) {
        if (progressDialog != null) {
            progressDialog.cancel();
        }

        progressDialog = new LoadingProgressDialog(getActivity(), loadingMsg);
        if (canBack) {
            progressDialog.setCancelable(true);
        } else {
            progressDialog.setCancelable(false);
        }
        progressDialog.show();
    }

    public void dismissProgressDialog() {
        if (null != progressDialog && progressDialog.isShowing()) {
            progressDialog.cancel();

        }
    }

}
